Skip to content

feat(lab11): hardened nginx + WAF sidecar - #12

Open
StefFashka wants to merge 2 commits into
mainfrom
feature/lab11
Open

feat(lab11): hardened nginx + WAF sidecar#12
StefFashka wants to merge 2 commits into
mainfrom
feature/lab11

Conversation

@StefFashka

Copy link
Copy Markdown
Owner

Goal

Harden OWASP Juice Shop v20.0.0 behind an Nginx reverse proxy with TLS 1.3, security headers, rate limiting, timeout controls, cipher hardening, and a ModSecurity/OWASP CRS WAF layer.

Changes

  • labs/lab11/reverse-proxy/nginx.conf β€” hardened Nginx reverse proxy with HTTP-to-HTTPS redirect, TLS 1.3 only, required security headers, rate limiting, connection limits, timeouts, and TLS session/cipher hardening.
  • labs/lab11/waf/ β€” added the bonus WAF sidecar using ModSecurity v3 with OWASP CRS 4.25.1, including audit log evidence for the blocked SQL injection payload.
  • submissions/lab11.md β€” added the Lab 11 submission report using the required template.
  • .gitignore β€” updated ignore rules for local/generated lab artifacts.

Testing

docker compose -f labs/lab11/docker-compose.yml -f labs/lab11/waf/docker-compose.override.yml ps
# Expected: juice, nginx, and waf containers Up; waf healthy

docker compose -f labs/lab11/docker-compose.yml run --rm --entrypoint "nginx -t" nginx
# Expected: nginx configuration file test is successful

curl.exe -sI http://localhost
# Expected: HTTP 308 redirect to https://localhost/

curl.exe -skI https://localhost
# Expected: HTTP 200 with HSTS, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy, and CSP-Report-Only headers

docker run --rm --add-host=host.docker.internal:host-gateway --entrypoint sh alpine/openssl -c "echo | openssl s_client -connect host.docker.internal:443 -tls1_3 -brief 2>&1"
# Expected: Protocol version: TLSv1.3

docker run --rm --add-host=host.docker.internal:host-gateway curlimages/curl:latest sh -c "seq 1 60 | xargs -n1 -P 30 -I{} curl -sk -o /dev/null -w '%{http_code}\n' https://host.docker.internal/rest/user/login 2>/dev/null | sort | uniq -c"
# Expected: many HTTP 429 responses from Nginx rate limiting

curl.exe -sk -o NUL -w "no-waf: HTTP %{http_code}`n" "https://localhost/rest/products/search?q='%20OR%201=1--"
# Expected: request reaches Juice Shop, no WAF block

curl.exe -sk -o NUL -w "with-waf: HTTP %{http_code}`n" "https://localhost:8443/rest/products/search?q='%20OR%201=1--"
# Expected: with-waf: HTTP 403

Artifacts & Screenshots

Submission report: lab11.md
Hardened Nginx config: nginx.conf
WAF compose override: docker-compose.override.yml
WAF audit log: audit.log

Required checklist:

  • Task 1 β€” TLS 1.3 + 6 security headers (with proof)
  • Task 2 β€” Rate limit + timeouts + cipher hardening + cert-rotation runbook
  • Bonus β€” Coraza/ModSec WAF + OWASP CRS catching a payload Nginx-alone passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant